package com.wzq.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wzq.bean.BldVulnerabilityModel;
import com.wzq.service.BldVulnerabilityService;
import com.wzq.util.ApiException;
import com.wzq.util.ApiResponse;
import com.wzq.util.Pager;
import com.wzq.util.ResponseCode;

@Controller
@RequestMapping("bldvulnerability/")
public class BldVulnerabilityController{
	@Autowired
	private BldVulnerabilityService BldVulnerabilityService;


	@RequestMapping("dataList")
	@ResponseBody
	public ApiResponse<List<BldVulnerabilityModel>> dataList(BldVulnerabilityModel model,HttpServletRequest request,Pager pager)throws ApiException{
		ApiResponse<List<BldVulnerabilityModel>> response = new  ApiResponse<List<BldVulnerabilityModel>>(ResponseCode.SUCC);       
		List<BldVulnerabilityModel> list = BldVulnerabilityService.queryList(model, pager);
		response.setData(list);	
		return response;
	}
	
	
	@RequestMapping("add")
	@ResponseBody
	public ApiResponse<String> add(BldVulnerabilityModel model,HttpServletRequest request)throws ApiException{
		ApiResponse<String> response = new  ApiResponse<String>(ResponseCode.SUCC);
		BldVulnerabilityService.add(model);
		return response;
	}
	
	@RequestMapping("update")
	@ResponseBody
	public ApiResponse<String> update(BldVulnerabilityModel model,HttpServletRequest request)throws ApiException{
		ApiResponse<String> response = new  ApiResponse<String>(ResponseCode.SUCC);
		BldVulnerabilityService.updateBySelective(model);
		return response;
	}
	
	@RequestMapping("delete")
	@ResponseBody
	public ApiResponse<String> delete(Integer id,HttpServletRequest request)throws ApiException{
		ApiResponse<String> response = new  ApiResponse<String>(ResponseCode.SUCC);
		BldVulnerabilityService.delete(id);
		return response;
	}
	
	@RequestMapping("getById")
	@ResponseBody
	public ApiResponse<BldVulnerabilityModel> getById(Integer id,HttpServletRequest request,Pager pager)throws ApiException{
		ApiResponse<BldVulnerabilityModel> response = new  ApiResponse<BldVulnerabilityModel>(ResponseCode.SUCC);       
		BldVulnerabilityModel model = BldVulnerabilityService.getById(id);
		response.setData(model);	
		return response;
	}
	
}
